package com.ipzoe.common.bean.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ipzoe.common.util.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;

/**
 * 后台管理员
 * <p>
 * Created on 2018/1/18.
 *
 * @author pfzhang
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Table(name = "admin")
@ApiModel(value = "Admin", description = "后台管理员")
public class Admin extends BaseEntity {

    /** 初始密码 123456 */
    public static final String INIT_PASSWORD = "123456";

    /** 状态 正常 = 0 */
    public static final Integer STATUS_NORMAL = 0;
    /** 状态 冻结 = 1 */
    public static final Integer STATUS_BLOCKED = 1;

    /** 用户名 */
    @ApiModelProperty("用户名")
    private String username;

    /** 密码 */
    @ApiModelProperty("密码")
    @JsonIgnore
    private String password;

    /** 账户状态. 0: 正常 1: 冻结 */
    @ApiModelProperty("账户状态. 0: 正常 1: 冻结")
    private Integer status;

    /** 角色ID */
    @ApiModelProperty("角色ID")
    private Long roleId;

    /** 角色 */
    @ApiModelProperty("角色")
    @Transient
    private Role role;

    /** Token */
    @ApiModelProperty("Token")
    @Transient
    private String token;

    /** 菜单 */
    @ApiModelProperty("菜单")
    @Transient
    private List<AdminMenu> adminMenusList;
}
